package com.macro.mall.config;

import com.macro.mall.util.EncryptionUtil;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 该类主要是在SpringBoot 启动后初始化一些基本类的信息
 *
 * @author by jicai on 2019/9/4.
 */
@Component
public class EncryptionConfig implements InitializingBean {

    @Value("${aes.iv}")
    private String iv;

    @Value("${aes.password}")
    private String password;

    @Override
    public void afterPropertiesSet() {

        //加密和解密的初始化
        EncryptionUtil.initEncryptionInfo(password, iv);

    }
}
